package com.serializable.externalizable;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class ExternalizableTest {

    /**
     * @param args
     * @throws IOException
     * @throws ClassNotFoundException
     */
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        System.out.println("序列化之前");
        Blip b = new Blip("This String is ", 47);
        System.out.println(b);

        System.out.println("序列化操作，writeObject");
//        ByteArrayOutputStream out = new ByteArrayOutputStream();
//        ObjectOutputStream oos = new ObjectOutputStream(out);
//        
        FileOutputStream fop=new FileOutputStream("/usr/local/project/mm/wholepr/aaa/target/a.txt");
        ObjectOutputStream oos=new ObjectOutputStream(fop);
        oos.writeObject(b);
        oos.close();
        System.out.println("反序列化之后,readObject");
//        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
//        ObjectInputStream ois = new ObjectInputStream(in);
//        Blip bb = (Blip) ois.readObject();
//        System.out.println(bb);
    }
}
